package com.stu.vertx.hello.vertxDemo.点对点;

import io.vertx.core.AbstractVerticle;
import io.vertx.core.Vertx;

/**
 * 点对点
 */
public class EventBusExample extends AbstractVerticle {

    public static void main(String[] args) {
        Vertx vertx = Vertx.vertx();
        vertx.deployVerticle(new EventBusExample());
    }

    @Override
    public void start() {
        vertx.eventBus().consumer("example.address", message -> {
            System.out.println("Received message: " + message.body());
            message.reply("Replying to the message");
        });

        vertx.eventBus().send("example.address", "Hello Vert.x");

    }
}